#include <stdio.h>


double distance(int length, double arr[length]);


int main(void)
{

	double arr1[5] = {1.1, 2.2, 3.3, 4.4, 5.5};
	double arr2[5] = {5.5, 4.4, 3.3, 2.2, 1.1};

	printf("distance1 is %.2f,distance2 is %.2f\n", 
		distance(5, arr1), distance(5, arr2));

}
double distance(int length, double arr[length])
{
	double max,min;
	int i;
	
	for( i = 1, max = arr[0], min = arr[0]; i< length; i++)
	{
		if(arr[i] > max)
		{
			max = arr[i];
			continue;
		}
		if(arr[i] < min)
		{
			min = arr[i];
			continue;
		}
	}
	
	return max - min;
}


